package org.luxor.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.luxor.commons.core.utils.DateUtils;
import org.luxor.commons.core.validator.group.AddGroup;
import org.luxor.commons.core.validator.group.UpdateGroup;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;


/**
 * 系统用户
 *
 * @author Mark @date 2020-07-28 14:29:25
 */
@Data
@TableName("tb_sys_user")
@ApiModel(description = "系统用户")
public class SysUserEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键Id")
    @NotNull(message = "用户 ID，不能为空", groups = UpdateGroup.class)
    private Long id;

    @ApiModelProperty(value = "租户ID")
    private Long tenantId;

    @ApiModelProperty(value = "登陆账号")
    @NotBlank(message = "userName，不能为空")
    private String userName;

    @ApiModelProperty(value = "所属组织部门ID")
    @NotNull(message = "deptId，不能为空")
    private Long deptId;

    @ApiModelProperty(value = "密码")
    @NotBlank(message = "password，不能为空", groups = AddGroup.class)
    private String password;

    @ApiModelProperty(value = "盐")
    private String salt;

    @ApiModelProperty(value = "人员姓名")
    @NotBlank(message = "realName，不能为空", groups = AddGroup.class)
    private String realName;

    @ApiModelProperty(value = "用户类型(0-普通成员；1-临时用户)")
    @NotNull(message = "userType，不能为空", groups = AddGroup.class)
    private Byte userType;

    @ApiModelProperty(value = "电话")
    private String mobile;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "身份证")
    private String idCard;

    @ApiModelProperty(value = "激活方式?(0-未激活；1-密码；2-手机短信码；3-邮件验证码；4-身份证识别)")
    private Byte verified;

    @ApiModelProperty(value = "图标", hidden = true)
    private Byte[] icon;

    @ApiModelProperty(value = "头像")
    private String avatar;

    @ApiModelProperty(value = "性别(0-女；1-男)")
    private Byte gender;

    @ApiModelProperty(value = "职务")
    private String post;

    @ApiModelProperty(value = "地址")
    private String address;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "排序")
    private Integer orderNo;

    @ApiModelProperty(value = "是否锁定(0-未锁定；1-锁定)")
    private Boolean accountLocked;

    @ApiModelProperty(value = "是否启动(1-启用；0-禁用)")
    private Boolean enabled;

    @ApiModelProperty(value = "逻辑删除(1-删除；0-未删除)")
    private Boolean deleted;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN, timezone = "GMT+8")
    private Date createTime;

}
